<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>监视器</title>
</head>
<body>
<div id="app">
    <input v-model="message"/>
    <div>
        <input v-model="firstName"/><input v-model="lastName"/>{{fullName}}
    </div>

</div>
</body>
<script src="../../../lib/vue.js"></script>
<script>

  /***
   * 监视器的使用场景：
   *     1. 异步---- ajax
   * */
  var app=  new Vue({
        el:'#app',
        data:{
            message:'hello',
            firstName:'first',
            lastName:'last',
            fullName:''
        },
        watch:{
            message:function (original,newObj) {
                alert("original is " + original);
                alert("newObj is " + newObj);
            },
            firstName: function (old,newO) {
               this.fullName =  this.firstName+this.lastName;
            },
            lastName: function (old,newO) {
                this.fullName = this.firstName+this.lastName;
            }
        }
    })

</script>

</html>